package com.ecoolex.chinadutyfree.retailer.ws;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import com.ecoolex.chinadutyfree.retailer.core.manager.PaymentOrderManager;
import com.ecoolex.chinadutyfree.retailer.core.manager.PaymentOrderRecordManager;
import com.ecoolex.chinadutyfree.retailer.entity.PaymentOrder;
import com.ecoolex.chinadutyfree.retailer.entity.PaymentOrderRecord;
import com.ecoolex.chinadutyfree.retailer.pojo.QueryPaymentOrderDTO;
import com.ecoolex.framework.common.pojo.Page;
import com.ecoolex.framework.common.pojo.Pagination;
import com.ecoolex.framework.common.pojo.Sorting;

@Service
public class PaymentOrderServiceImpl implements PaymentOrderService{
	
	@Autowired
	private PaymentOrderManager paymentOrderManager;
	
	@Autowired
	private PaymentOrderRecordManager paymentOrderRecordManager;

	@Override
	public String pay(Integer type,String orderNo,String currencyType,Integer userId,
		BigDecimal realPrice,Date orderCreateTime,
		HttpServletRequest request, HttpServletResponse resp,String createUser) {
		return paymentOrderManager.pay(type,orderNo,currencyType,userId,realPrice, orderCreateTime,request,resp,createUser);
	}

	@Override
	public void orderNotify(HttpServletRequest req, HttpServletResponse response, String createUser) throws Exception{
		paymentOrderManager.orderNotify(req, response, createUser);
	}

	@Override
	public void refundNotify(HttpServletRequest req, HttpServletResponse response, String createUser)throws Exception {
		paymentOrderManager.refundNotify(req, response, createUser);
	}

	@Override
	public void payFrontNotify(HttpServletRequest req, HttpServletResponse response) throws Exception{
		paymentOrderManager.payFrontNotify(req, response);
	}

	@Override
	public PaymentOrder getByOrderNo(String orderNo) {
		return paymentOrderManager.getByOrderNo(orderNo);
	}

	@Override
	public PaymentOrder getOrderById(Integer paymentOrderId) {
		return paymentOrderManager.getById(paymentOrderId);
	}

	@Override
	public Pagination<PaymentOrder> queryOrderByQuery(QueryPaymentOrderDTO query, Sorting[] sorts, Page page) {
		return paymentOrderManager.queryByQuery(query, sorts, page);
	}

	@Override
	public List<PaymentOrderRecord> queryRecordByOrderId(Integer paymentOrderId) {
		return paymentOrderRecordManager.queryByOrderId(paymentOrderId);
	}

}
